import sys
import matplotlib as mpl
import matplotlib.pyplot as plt
import sys

def main():
    save_name = sys.argv[1]
    print(save_name)
    # mpl.rcParams['axes.spines.top'] = False
    # mpl.rcParams['axes.spines.right'] = False
    mpl.rcParams['axes.edgecolor'] = 'none'

    # my_color = (170 / 255, 220 / 255, 224 / 255)
    my_color = '#26547C'

    row = []
    col = []

    with open('./cache/pattern/data.txt', 'r') as f:
        line = f.readline()
        data = line.strip().split()
        if len(data) % 2 != 0:
            print("error")
        for i in range(0, len(data), 2):
            row.append(int(data[i]))
            col.append(int(data[i + 1]))

    fig, axs = plt.subplots(1, 1, figsize=(4, 4))
    axs.scatter(row, col, s=0.1, color=my_color, marker='.')
    axs.set_xticks([])
    axs.set_yticks([])
    axs.invert_yaxis()
    axs.xaxis.set_ticks_position('top')
    plt.subplots_adjust(left=0, right=1, top=1, bottom=0)
    plt.savefig(f'./cache/pattern/{save_name}.png', format='png', dpi=600)

if __name__ == "__main__":
    main()
